package com.xcx.robot.mirai.factory;

import com.xcx.robot.mirai.key.KeyWord;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 邢晨旭
 * @Date: 2021/5/26 16:07
 * @Description:
 */
@Component
public class MessageFactory {

    @Resource
    List<BaseFacade> messageFacades;

    public BaseFacade get(KeyWord keyWord) {
        for (BaseFacade baseFacade : messageFacades) {
            if (baseFacade.keyWord().equals(keyWord)) {
                return baseFacade;
            }
        }
        return null;
    }

}
